package jsqlite.JDBC2z;

import com.github.mikephil.charting.utils.Utils;
import java.io.ByteArrayInputStream;
import java.io.CharArrayReader;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Map;
import jsqlite.Database;
import jsqlite.Exception;
import jsqlite.Shell;
import jsqlite.StringEncoder;
import jsqlite.TableResult;

/* loaded from: classes2.dex */
public class JDBCResultSet implements ResultSet {
    private static final int UPD_INS = 1;
    private static final int UPD_INSUPDDEL = 2;
    private static final int UPD_NO = 0;
    private static final int UPD_UNKNOWN = -1;
    private static final boolean nullrepl;
    private int[] pkcoli;
    private String[] pkcols;
    private JDBCStatement s;
    protected TableResult tr;
    private String uptable;
    private JDBCResultSetMetaData md = null;
    private String lastg = null;
    private int row = -1;
    private int updatable = -1;
    private boolean oninsrow = false;
    private String[] rowbuf = null;

    @Override // java.sql.ResultSet
    public int getConcurrency() throws SQLException {
        return 1008;
    }

    @Override // java.sql.ResultSet
    public String getCursorName() throws SQLException {
        return null;
    }

    @Override // java.sql.ResultSet
    public int getFetchDirection() throws SQLException {
        return 1000;
    }

    @Override // java.sql.ResultSet
    public int getFetchSize() throws SQLException {
        return 1;
    }

    @Override // java.sql.ResultSet
    public int getHoldability() throws SQLException {
        return 2;
    }

    @Override // java.sql.ResultSet
    public int getType() throws SQLException {
        return 1005;
    }

    @Override // java.sql.Wrapper
    public boolean isWrapperFor(Class cls) throws SQLException {
        return false;
    }

    @Override // java.sql.ResultSet
    public boolean rowDeleted() throws SQLException {
        return false;
    }

    @Override // java.sql.ResultSet
    public boolean rowInserted() throws SQLException {
        return false;
    }

    @Override // java.sql.ResultSet
    public boolean rowUpdated() throws SQLException {
        return false;
    }

    static {
        nullrepl = Database.version().compareTo("2.5.0") < 0;
    }

    public JDBCResultSet(TableResult tableResult, JDBCStatement jDBCStatement) {
        this.tr = tableResult;
        this.s = jDBCStatement;
    }

    public boolean isUpdatable() throws SQLException {
        if (this.updatable == -1) {
            try {
                JDBCResultSetMetaData jDBCResultSetMetaData = (JDBCResultSetMetaData) getMetaData();
                HashSet hashSet = new HashSet();
                String str = null;
                for (int i = 1; i <= this.tr.ncolumns; i++) {
                    str = jDBCResultSetMetaData.getTableName(i);
                    hashSet.add(str);
                }
                if (hashSet.size() > 1 || str == null) {
                    this.updatable = 0;
                    throw new SQLException("view or join");
                }
                this.updatable = 1;
                this.uptable = str;
                JDBCResultSet jDBCResultSet = (JDBCResultSet) this.s.conn.getMetaData().getPrimaryKeys(null, null, this.uptable);
                if (jDBCResultSet.tr.nrows > 0) {
                    this.pkcols = new String[jDBCResultSet.tr.nrows];
                    this.pkcoli = new int[jDBCResultSet.tr.nrows];
                    boolean z = false;
                    for (int i2 = 0; i2 < jDBCResultSet.tr.nrows; i2++) {
                        String[] strArr = this.pkcols;
                        strArr[i2] = ((String[]) jDBCResultSet.tr.rows.elementAt(i2))[3];
                        try {
                            this.pkcoli[i2] = findColumn(strArr[i2]) - 1;
                        } catch (SQLException unused) {
                            z = true;
                        }
                    }
                    if (!z) {
                        this.updatable = 2;
                    }
                }
                jDBCResultSet.close();
            } catch (SQLException unused2) {
                this.updatable = 0;
            }
        }
        if (this.updatable >= 1) {
            return true;
        }
        throw new SQLException("result set not updatable");
    }

    public void fillRowbuf() throws SQLException {
        if (this.rowbuf == null) {
            if (this.row < 0) {
                throw new SQLException("cursor outside of result set");
            }
            this.rowbuf = new String[this.tr.ncolumns];
            System.arraycopy((String[]) this.tr.rows.elementAt(this.row), 0, this.rowbuf, 0, this.tr.ncolumns);
        }
    }

    @Override // java.sql.ResultSet
    public boolean next() throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null) {
            return false;
        }
        int i = this.row + 1;
        this.row = i;
        return i < tableResult.nrows;
    }

    @Override // java.sql.ResultSet
    public int findColumn(String str) throws SQLException {
        return ((JDBCResultSetMetaData) getMetaData()).findColByName(str);
    }

    @Override // java.sql.ResultSet
    public int getRow() throws SQLException {
        if (this.tr == null) {
            throw new SQLException("no rows");
        }
        return this.row + 1;
    }

    @Override // java.sql.ResultSet
    public boolean previous() throws SQLException {
        if (this.tr == null) {
            throw new SQLException("result set already closed.");
        }
        int i = this.row;
        if (i >= 0) {
            this.row = i - 1;
        }
        return this.row >= 0;
    }

    @Override // java.sql.ResultSet
    public boolean absolute(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null) {
            return false;
        }
        if (i < 0) {
            i += tableResult.nrows + 1;
        }
        int i2 = i - 1;
        if (i2 < 0 || i2 > this.tr.nrows) {
            return false;
        }
        this.row = i2;
        return true;
    }

    @Override // java.sql.ResultSet
    public boolean relative(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null) {
            return false;
        }
        int i2 = this.row;
        if (i2 + i < 0 || i2 + i >= tableResult.nrows) {
            return false;
        }
        this.row += i;
        return true;
    }

    @Override // java.sql.ResultSet
    public void setFetchDirection(int i) throws SQLException {
        if (i != 1000) {
            throw new SQLException("only forward fetch direction supported");
        }
    }

    @Override // java.sql.ResultSet
    public void setFetchSize(int i) throws SQLException {
        if (i != 1) {
            throw new SQLException("fetch size must be 1");
        }
    }

    @Override // java.sql.ResultSet
    public String getString(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        return str;
    }

    @Override // java.sql.ResultSet
    public String getString(String str) throws SQLException {
        return getString(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public int getInt(int i) throws SQLException {
        Integer internalGetInt = internalGetInt(i);
        if (internalGetInt != null) {
            return internalGetInt.intValue();
        }
        return 0;
    }

    private Integer internalGetInt(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        try {
            return Integer.valueOf(str);
        } catch (Exception unused) {
            this.lastg = null;
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public int getInt(String str) throws SQLException {
        return getInt(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public boolean getBoolean(int i) throws SQLException {
        return getInt(i) == 1 || Boolean.parseBoolean(getString(i));
    }

    @Override // java.sql.ResultSet
    public boolean getBoolean(String str) throws SQLException {
        return getBoolean(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public ResultSetMetaData getMetaData() throws SQLException {
        if (this.md == null) {
            this.md = new JDBCResultSetMetaData(this);
        }
        return this.md;
    }

    @Override // java.sql.ResultSet
    public short getShort(int i) throws SQLException {
        Short internalGetShort = internalGetShort(i);
        if (internalGetShort != null) {
            return internalGetShort.shortValue();
        }
        return (short) 0;
    }

    private Short internalGetShort(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        try {
            return Short.valueOf(str);
        } catch (Exception unused) {
            this.lastg = null;
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public short getShort(String str) throws SQLException {
        return getShort(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Time getTime(int i) throws SQLException {
        return internalGetTime(i, null);
    }

    private Time internalGetTime(int i, Calendar calendar) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        this.lastg = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        try {
            if (this.s.conn.useJulian) {
                try {
                    return new Time(Database.long_from_julian(this.lastg));
                } catch (Exception unused) {
                    return Time.valueOf(this.lastg);
                }
            }
            try {
                return Time.valueOf(this.lastg);
            } catch (Exception unused2) {
                return new Time(Database.long_from_julian(this.lastg));
            }
        } catch (Exception unused3) {
            this.lastg = null;
            return null;
        }
        this.lastg = null;
        return null;
    }

    @Override // java.sql.ResultSet
    public Time getTime(String str) throws SQLException {
        return getTime(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Time getTime(int i, Calendar calendar) throws SQLException {
        return internalGetTime(i, calendar);
    }

    @Override // java.sql.ResultSet
    public Time getTime(String str, Calendar calendar) throws SQLException {
        return getTime(findColumn(str), calendar);
    }

    @Override // java.sql.ResultSet
    public Timestamp getTimestamp(int i) throws SQLException {
        return internalGetTimestamp(i, null);
    }

    private Timestamp internalGetTimestamp(int i, Calendar calendar) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        this.lastg = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        try {
            if (this.s.conn.useJulian) {
                try {
                    return new Timestamp(Database.long_from_julian(this.lastg));
                } catch (Exception unused) {
                    return Timestamp.valueOf(this.lastg);
                }
            }
            try {
                return Timestamp.valueOf(this.lastg);
            } catch (Exception unused2) {
                return new Timestamp(Database.long_from_julian(this.lastg));
            }
        } catch (Exception unused3) {
            this.lastg = null;
            return null;
        }
        this.lastg = null;
        return null;
    }

    @Override // java.sql.ResultSet
    public Timestamp getTimestamp(String str) throws SQLException {
        return getTimestamp(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Timestamp getTimestamp(int i, Calendar calendar) throws SQLException {
        return internalGetTimestamp(i, calendar);
    }

    @Override // java.sql.ResultSet
    public Timestamp getTimestamp(String str, Calendar calendar) throws SQLException {
        return getTimestamp(findColumn(str), calendar);
    }

    @Override // java.sql.ResultSet
    public Date getDate(int i) throws SQLException {
        return internalGetDate(i, null);
    }

    private Date internalGetDate(int i, Calendar calendar) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        this.lastg = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        try {
            if (this.s.conn.useJulian) {
                try {
                    return new Date(Database.long_from_julian(this.lastg));
                } catch (Exception unused) {
                    return Date.valueOf(this.lastg);
                }
            }
            try {
                return Date.valueOf(this.lastg);
            } catch (Exception unused2) {
                return new Date(Database.long_from_julian(this.lastg));
            }
        } catch (Exception unused3) {
            this.lastg = null;
            return null;
        }
        this.lastg = null;
        return null;
    }

    @Override // java.sql.ResultSet
    public Date getDate(String str) throws SQLException {
        return getDate(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Date getDate(int i, Calendar calendar) throws SQLException {
        return internalGetDate(i, calendar);
    }

    @Override // java.sql.ResultSet
    public Date getDate(String str, Calendar calendar) throws SQLException {
        return getDate(findColumn(str), calendar);
    }

    @Override // java.sql.ResultSet
    public double getDouble(int i) throws SQLException {
        Double internalGetDouble = internalGetDouble(i);
        return internalGetDouble != null ? internalGetDouble.doubleValue() : Utils.DOUBLE_EPSILON;
    }

    private Double internalGetDouble(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        try {
            return Double.valueOf(str);
        } catch (Exception unused) {
            this.lastg = null;
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public double getDouble(String str) throws SQLException {
        return getDouble(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public float getFloat(int i) throws SQLException {
        Float internalGetFloat = internalGetFloat(i);
        if (internalGetFloat != null) {
            return internalGetFloat.floatValue();
        }
        return 0.0f;
    }

    private Float internalGetFloat(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        try {
            return Float.valueOf(str);
        } catch (Exception unused) {
            this.lastg = null;
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public float getFloat(String str) throws SQLException {
        return getFloat(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public long getLong(int i) throws SQLException {
        Long internalGetLong = internalGetLong(i);
        if (internalGetLong != null) {
            return internalGetLong.longValue();
        }
        return 0L;
    }

    private Long internalGetLong(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        try {
            return Long.valueOf(str);
        } catch (Exception unused) {
            this.lastg = null;
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public long getLong(String str) throws SQLException {
        return getLong(findColumn(str));
    }

    @Override // java.sql.ResultSet
    @Deprecated
    public InputStream getUnicodeStream(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    @Deprecated
    public InputStream getUnicodeStream(String str) throws SQLException {
        return getUnicodeStream(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public InputStream getAsciiStream(String str) throws SQLException {
        return getAsciiStream(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public InputStream getAsciiStream(int i) throws SQLException {
        throw new SQLException("not supported");
    }

    @Override // java.sql.ResultSet
    public BigDecimal getBigDecimal(String str) throws SQLException {
        return getBigDecimal(findColumn(str));
    }

    @Override // java.sql.ResultSet
    @Deprecated
    public BigDecimal getBigDecimal(String str, int i) throws SQLException {
        return getBigDecimal(findColumn(str), i);
    }

    @Override // java.sql.ResultSet
    public BigDecimal getBigDecimal(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    @Deprecated
    public BigDecimal getBigDecimal(int i, int i2) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public InputStream getBinaryStream(int i) throws SQLException {
        byte[] bytes = getBytes(i);
        if (bytes != null) {
            return new ByteArrayInputStream(bytes);
        }
        return null;
    }

    @Override // java.sql.ResultSet
    public InputStream getBinaryStream(String str) throws SQLException {
        byte[] bytes = getBytes(str);
        if (bytes != null) {
            return new ByteArrayInputStream(bytes);
        }
        return null;
    }

    @Override // java.sql.ResultSet
    public byte getByte(int i) throws SQLException {
        throw new SQLException("not supported");
    }

    @Override // java.sql.ResultSet
    public byte getByte(String str) throws SQLException {
        return getByte(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public byte[] getBytes(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        byte[] bArr = null;
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        return str != null ? StringEncoder.decode(str) : bArr;
    }

    @Override // java.sql.ResultSet
    public byte[] getBytes(String str) throws SQLException {
        return getBytes(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Object getObject(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        int i2 = i - 1;
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i2];
        this.lastg = str;
        TableResult tableResult2 = this.tr;
        if (tableResult2 instanceof TableResultX) {
            int i3 = ((TableResultX) tableResult2).sql_type[i2];
            if (i3 != -5) {
                if (i3 == -4 || i3 == -3 || i3 == -2) {
                    return getBytes(i);
                }
                if (i3 != 0) {
                    if (i3 != 8) {
                        if (i3 != 4) {
                            if (i3 != 5) {
                                return i3 != 6 ? str : internalGetFloat(i);
                            }
                            return internalGetShort(i);
                        }
                        return internalGetInt(i);
                    }
                    return internalGetDouble(i);
                }
                return null;
            }
            return internalGetLong(i);
        }
        return str;
    }

    @Override // java.sql.ResultSet
    public Object getObject(String str) throws SQLException {
        return getObject(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Object getObject(int i, Map map) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Object getObject(String str, Map map) throws SQLException {
        return getObject(findColumn(str), map);
    }

    @Override // java.sql.ResultSet
    public Ref getRef(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Ref getRef(String str) throws SQLException {
        return getRef(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Blob getBlob(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Blob getBlob(String str) throws SQLException {
        return getBlob(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Clob getClob(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Clob getClob(String str) throws SQLException {
        return getClob(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Array getArray(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Array getArray(String str) throws SQLException {
        return getArray(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Reader getCharacterStream(int i) throws SQLException {
        String string = getString(i);
        if (string != null) {
            return new CharArrayReader(string.toCharArray());
        }
        return null;
    }

    @Override // java.sql.ResultSet
    public Reader getCharacterStream(String str) throws SQLException {
        String string = getString(str);
        if (string != null) {
            return new CharArrayReader(string.toCharArray());
        }
        return null;
    }

    @Override // java.sql.ResultSet
    public SQLWarning getWarnings() throws SQLException {
        throw new SQLException("not supported");
    }

    @Override // java.sql.ResultSet
    public boolean wasNull() throws SQLException {
        return this.lastg == null;
    }

    @Override // java.sql.ResultSet
    public void clearWarnings() throws SQLException {
        throw new SQLException("not supported");
    }

    @Override // java.sql.ResultSet
    public boolean isFirst() throws SQLException {
        return this.tr == null || this.row == 0;
    }

    @Override // java.sql.ResultSet
    public boolean isBeforeFirst() throws SQLException {
        TableResult tableResult = this.tr;
        return tableResult != null && tableResult.nrows > 0 && this.row < 0;
    }

    @Override // java.sql.ResultSet
    public void beforeFirst() throws SQLException {
        if (this.tr == null) {
            return;
        }
        this.row = -1;
    }

    @Override // java.sql.ResultSet
    public boolean first() throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || tableResult.nrows <= 0) {
            return false;
        }
        this.row = 0;
        return true;
    }

    @Override // java.sql.ResultSet
    public boolean isAfterLast() throws SQLException {
        TableResult tableResult = this.tr;
        return tableResult != null && tableResult.nrows > 0 && this.row >= this.tr.nrows;
    }

    @Override // java.sql.ResultSet
    public void afterLast() throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null) {
            return;
        }
        this.row = tableResult.nrows;
    }

    @Override // java.sql.ResultSet
    public boolean isLast() throws SQLException {
        TableResult tableResult = this.tr;
        return tableResult == null || this.row == tableResult.nrows - 1;
    }

    @Override // java.sql.ResultSet
    public boolean last() throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || tableResult.nrows <= 0) {
            return false;
        }
        this.row = this.tr.nrows - 1;
        return true;
    }

    @Override // java.sql.ResultSet
    public void insertRow() throws SQLException {
        isUpdatable();
        if (!this.oninsrow || this.rowbuf == null) {
            throw new SQLException("no insert data provided");
        }
        JDBCResultSetMetaData jDBCResultSetMetaData = (JDBCResultSetMetaData) getMetaData();
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("INSERT INTO ");
        stringBuffer.append(Shell.sql_quote_dbl(this.uptable));
        stringBuffer.append("(");
        int i = 0;
        while (i < this.tr.ncolumns) {
            int i2 = i + 1;
            stringBuffer.append(Shell.sql_quote_dbl(jDBCResultSetMetaData.getColumnName(i2)));
            if (i < this.tr.ncolumns - 1) {
                stringBuffer.append(",");
            }
            i = i2;
        }
        stringBuffer.append(") VALUES(");
        for (int i3 = 0; i3 < this.tr.ncolumns; i3++) {
            stringBuffer.append(nullrepl ? "'%q'" : "%Q");
            if (i3 < this.tr.ncolumns - 1) {
                stringBuffer.append(",");
            }
        }
        stringBuffer.append(")");
        try {
            this.s.conn.db.exec(stringBuffer.toString(), null, this.rowbuf);
            this.tr.newrow(this.rowbuf);
            this.rowbuf = null;
            this.oninsrow = false;
            last();
        } catch (Exception e) {
            throw new SQLException(e.getMessage());
        }
    }

    @Override // java.sql.ResultSet
    public void updateRow() throws SQLException {
        isUpdatable();
        if (this.rowbuf == null) {
            throw new SQLException("no update data provided");
        }
        if (this.oninsrow) {
            throw new SQLException("cursor on insert row");
        }
        if (this.updatable < 2) {
            throw new SQLException("no primary key on table defined");
        }
        String[] strArr = (String[]) this.tr.rows.elementAt(this.row);
        JDBCResultSetMetaData jDBCResultSetMetaData = (JDBCResultSetMetaData) getMetaData();
        String[] strArr2 = new String[this.tr.ncolumns + this.pkcols.length];
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("UPDATE ");
        stringBuffer.append(Shell.sql_quote_dbl(this.uptable));
        stringBuffer.append(" SET ");
        int i = 0;
        while (true) {
            if (i >= this.tr.ncolumns) {
                break;
            }
            int i2 = i + 1;
            stringBuffer.append(Shell.sql_quote_dbl(jDBCResultSetMetaData.getColumnName(i2)));
            StringBuilder sb = new StringBuilder(" = ");
            sb.append(nullrepl ? "'%q'" : "%Q");
            stringBuffer.append(sb.toString());
            if (i < this.tr.ncolumns - 1) {
                stringBuffer.append(",");
            }
            strArr2[i] = this.rowbuf[i];
            i = i2;
        }
        stringBuffer.append(" WHERE ");
        int i3 = 0;
        while (true) {
            String[] strArr3 = this.pkcols;
            if (i3 < strArr3.length) {
                stringBuffer.append(Shell.sql_quote_dbl(strArr3[i3]));
                StringBuilder sb2 = new StringBuilder(" = ");
                sb2.append(nullrepl ? "'%q'" : "%Q");
                stringBuffer.append(sb2.toString());
                if (i3 < this.pkcols.length - 1) {
                    stringBuffer.append(" AND ");
                }
                strArr2[i] = strArr[this.pkcoli[i3]];
                i3++;
                i++;
            } else {
                try {
                    this.s.conn.db.exec(stringBuffer.toString(), null, strArr2);
                    String[] strArr4 = this.rowbuf;
                    System.arraycopy(strArr4, 0, strArr, 0, strArr4.length);
                    this.rowbuf = null;
                    return;
                } catch (Exception e) {
                    throw new SQLException(e.getMessage());
                }
            }
        }
    }

    @Override // java.sql.ResultSet
    public void deleteRow() throws SQLException {
        isUpdatable();
        if (this.oninsrow) {
            throw new SQLException("cursor on insert row");
        }
        if (this.updatable < 2) {
            throw new SQLException("no primary key on table defined");
        }
        fillRowbuf();
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("DELETE FROM ");
        stringBuffer.append(Shell.sql_quote_dbl(this.uptable));
        stringBuffer.append(" WHERE ");
        String[] strArr = new String[this.pkcols.length];
        int i = 0;
        while (true) {
            String[] strArr2 = this.pkcols;
            if (i < strArr2.length) {
                stringBuffer.append(Shell.sql_quote_dbl(strArr2[i]));
                StringBuilder sb = new StringBuilder(" = ");
                sb.append(nullrepl ? "'%q'" : "%Q");
                stringBuffer.append(sb.toString());
                if (i < this.pkcols.length - 1) {
                    stringBuffer.append(" AND ");
                }
                strArr[i] = this.rowbuf[this.pkcoli[i]];
                i++;
            } else {
                try {
                    this.s.conn.db.exec(stringBuffer.toString(), null, strArr);
                    this.rowbuf = null;
                    return;
                } catch (Exception e) {
                    throw new SQLException(e.getMessage());
                }
            }
        }
    }

    @Override // java.sql.ResultSet
    public void refreshRow() throws SQLException {
        isUpdatable();
        if (this.oninsrow) {
            throw new SQLException("cursor on insert row");
        }
        if (this.updatable < 2) {
            throw new SQLException("no primary key on table defined");
        }
        JDBCResultSetMetaData jDBCResultSetMetaData = (JDBCResultSetMetaData) getMetaData();
        String[] strArr = (String[]) this.tr.rows.elementAt(this.row);
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("SELECT ");
        int i = 0;
        while (i < this.tr.ncolumns) {
            int i2 = i + 1;
            stringBuffer.append(Shell.sql_quote_dbl(jDBCResultSetMetaData.getColumnName(i2)));
            if (i < this.tr.ncolumns - 1) {
                stringBuffer.append(",");
            }
            i = i2;
        }
        stringBuffer.append(" FROM ");
        stringBuffer.append(Shell.sql_quote_dbl(this.uptable));
        stringBuffer.append(" WHERE ");
        String[] strArr2 = new String[this.pkcols.length];
        int i3 = 0;
        while (true) {
            String[] strArr3 = this.pkcols;
            if (i3 < strArr3.length) {
                stringBuffer.append(Shell.sql_quote_dbl(strArr3[i3]));
                StringBuilder sb = new StringBuilder(" = ");
                sb.append(nullrepl ? "'%q'" : "%Q");
                stringBuffer.append(sb.toString());
                if (i3 < this.pkcols.length - 1) {
                    stringBuffer.append(" AND ");
                }
                strArr2[i3] = strArr[this.pkcoli[i3]];
                i3++;
            } else {
                try {
                    break;
                } catch (Exception e) {
                    throw new SQLException(e.getMessage());
                }
            }
        }
        TableResult tableResult = this.s.conn.db.get_table(stringBuffer.toString(), strArr2);
        if (tableResult.nrows != 1) {
            throw new SQLException("wrong size of result set");
        }
        this.rowbuf = null;
        this.tr.rows.setElementAt(tableResult.rows.elementAt(0), this.row);
    }

    @Override // java.sql.ResultSet
    public void cancelRowUpdates() throws SQLException {
        this.rowbuf = null;
    }

    @Override // java.sql.ResultSet
    public void moveToInsertRow() throws SQLException {
        isUpdatable();
        if (this.oninsrow) {
            return;
        }
        this.oninsrow = true;
        this.rowbuf = new String[this.tr.nrows];
    }

    @Override // java.sql.ResultSet
    public void moveToCurrentRow() throws SQLException {
        if (this.oninsrow) {
            this.oninsrow = false;
            this.rowbuf = null;
        }
    }

    @Override // java.sql.ResultSet
    public void updateNull(int i) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = null;
    }

    @Override // java.sql.ResultSet
    public void updateBoolean(int i, boolean z) throws SQLException {
        updateString(i, z ? "1" : "0");
    }

    @Override // java.sql.ResultSet
    public void updateByte(int i, byte b) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateShort(int i, short s) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = Short.toString(s);
    }

    @Override // java.sql.ResultSet
    public void updateInt(int i, int i2) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = Integer.toString(i2);
    }

    @Override // java.sql.ResultSet
    public void updateLong(int i, long j) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = Long.toString(j);
    }

    @Override // java.sql.ResultSet
    public void updateFloat(int i, float f) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = Float.toString(f);
    }

    @Override // java.sql.ResultSet
    public void updateDouble(int i, double d) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = Double.toString(d);
    }

    @Override // java.sql.ResultSet
    public void updateBigDecimal(int i, BigDecimal bigDecimal) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateString(int i, String str) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = str;
    }

    @Override // java.sql.ResultSet
    public void updateBytes(int i, byte[] bArr) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        if (this.s.conn.db.is3()) {
            this.rowbuf[i - 1] = StringEncoder.encodeX(bArr);
        } else {
            this.rowbuf[i - 1] = StringEncoder.encode(bArr);
        }
    }

    @Override // java.sql.ResultSet
    public void updateDate(int i, Date date) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = date.toString();
    }

    @Override // java.sql.ResultSet
    public void updateTime(int i, Time time) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = time.toString();
    }

    @Override // java.sql.ResultSet
    public void updateTimestamp(int i, Timestamp timestamp) throws SQLException {
        isUpdatable();
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        fillRowbuf();
        this.rowbuf[i - 1] = timestamp.toString();
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(int i, InputStream inputStream, int i2) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(int i, InputStream inputStream, int i2) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(int i, Reader reader, int i2) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateObject(int i, Object obj) throws SQLException {
        updateString(i, obj.toString());
    }

    @Override // java.sql.ResultSet
    public void updateObject(int i, Object obj, int i2) throws SQLException {
        updateString(i, obj.toString());
    }

    @Override // java.sql.ResultSet
    public void updateNull(String str) throws SQLException {
        updateNull(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public void updateBoolean(String str, boolean z) throws SQLException {
        updateBoolean(findColumn(str), z);
    }

    @Override // java.sql.ResultSet
    public void updateByte(String str, byte b) throws SQLException {
        updateByte(findColumn(str), b);
    }

    @Override // java.sql.ResultSet
    public void updateShort(String str, short s) throws SQLException {
        updateShort(findColumn(str), s);
    }

    @Override // java.sql.ResultSet
    public void updateInt(String str, int i) throws SQLException {
        updateInt(findColumn(str), i);
    }

    @Override // java.sql.ResultSet
    public void updateLong(String str, long j) throws SQLException {
        updateLong(findColumn(str), j);
    }

    @Override // java.sql.ResultSet
    public void updateFloat(String str, float f) throws SQLException {
        updateFloat(findColumn(str), f);
    }

    @Override // java.sql.ResultSet
    public void updateDouble(String str, double d) throws SQLException {
        updateDouble(findColumn(str), d);
    }

    @Override // java.sql.ResultSet
    public void updateBigDecimal(String str, BigDecimal bigDecimal) throws SQLException {
        updateBigDecimal(findColumn(str), bigDecimal);
    }

    @Override // java.sql.ResultSet
    public void updateString(String str, String str2) throws SQLException {
        updateString(findColumn(str), str2);
    }

    @Override // java.sql.ResultSet
    public void updateBytes(String str, byte[] bArr) throws SQLException {
        updateBytes(findColumn(str), bArr);
    }

    @Override // java.sql.ResultSet
    public void updateDate(String str, Date date) throws SQLException {
        updateDate(findColumn(str), date);
    }

    @Override // java.sql.ResultSet
    public void updateTime(String str, Time time) throws SQLException {
        updateTime(findColumn(str), time);
    }

    @Override // java.sql.ResultSet
    public void updateTimestamp(String str, Timestamp timestamp) throws SQLException {
        updateTimestamp(findColumn(str), timestamp);
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(String str, InputStream inputStream, int i) throws SQLException {
        updateAsciiStream(findColumn(str), inputStream, i);
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(String str, InputStream inputStream, int i) throws SQLException {
        updateBinaryStream(findColumn(str), inputStream, i);
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(String str, Reader reader, int i) throws SQLException {
        updateCharacterStream(findColumn(str), reader, i);
    }

    @Override // java.sql.ResultSet
    public void updateObject(String str, Object obj) throws SQLException {
        updateObject(findColumn(str), obj);
    }

    @Override // java.sql.ResultSet
    public void updateObject(String str, Object obj, int i) throws SQLException {
        updateObject(findColumn(str), obj, i);
    }

    @Override // java.sql.ResultSet
    public Statement getStatement() throws SQLException {
        JDBCStatement jDBCStatement = this.s;
        if (jDBCStatement != null) {
            return jDBCStatement;
        }
        throw new SQLException("stale result set");
    }

    @Override // java.sql.ResultSet, java.lang.AutoCloseable
    public void close() throws SQLException {
        this.s = null;
        this.tr = null;
        this.lastg = null;
        this.oninsrow = false;
        this.rowbuf = null;
        this.row = -1;
    }

    @Override // java.sql.ResultSet
    public URL getURL(int i) throws SQLException {
        TableResult tableResult = this.tr;
        if (tableResult == null || i < 1 || i > tableResult.ncolumns) {
            throw new SQLException("column " + i + " not found");
        }
        String str = ((String[]) this.tr.rows.elementAt(this.row))[i - 1];
        this.lastg = str;
        if (str == null) {
            return null;
        }
        try {
            return new URL(this.lastg);
        } catch (Exception unused) {
            return null;
        }
    }

    @Override // java.sql.ResultSet
    public URL getURL(String str) throws SQLException {
        return getURL(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public void updateRef(int i, Ref ref) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateRef(String str, Ref ref) throws SQLException {
        updateRef(findColumn(str), ref);
    }

    @Override // java.sql.ResultSet
    public void updateBlob(int i, Blob blob) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBlob(String str, Blob blob) throws SQLException {
        updateBlob(findColumn(str), blob);
    }

    @Override // java.sql.ResultSet
    public void updateClob(int i, Clob clob) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateClob(String str, Clob clob) throws SQLException {
        updateClob(findColumn(str), clob);
    }

    @Override // java.sql.ResultSet
    public void updateArray(int i, Array array) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateArray(String str, Array array) throws SQLException {
        updateArray(findColumn(str), array);
    }

    @Override // java.sql.ResultSet
    public RowId getRowId(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public RowId getRowId(String str) throws SQLException {
        return getRowId(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public void updateRowId(int i, RowId rowId) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateRowId(String str, RowId rowId) throws SQLException {
        updateRowId(findColumn(str), rowId);
    }

    @Override // java.sql.ResultSet
    public boolean isClosed() throws SQLException {
        return this.tr == null;
    }

    @Override // java.sql.ResultSet
    public void updateNString(int i, String str) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNString(String str, String str2) throws SQLException {
        updateNString(findColumn(str), str2);
    }

    @Override // java.sql.ResultSet
    public void updateNClob(int i, NClob nClob) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNClob(String str, NClob nClob) throws SQLException {
        updateNClob(findColumn(str), nClob);
    }

    @Override // java.sql.ResultSet
    public NClob getNClob(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public NClob getNClob(String str) throws SQLException {
        return getNClob(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public SQLXML getSQLXML(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public SQLXML getSQLXML(String str) throws SQLException {
        return getSQLXML(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public void updateSQLXML(int i, SQLXML sqlxml) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateSQLXML(String str, SQLXML sqlxml) throws SQLException {
        updateSQLXML(findColumn(str), sqlxml);
    }

    @Override // java.sql.ResultSet
    public String getNString(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public String getNString(String str) throws SQLException {
        return getNString(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public Reader getNCharacterStream(int i) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public Reader getNCharacterStream(String str) throws SQLException {
        return getNCharacterStream(findColumn(str));
    }

    @Override // java.sql.ResultSet
    public void updateNCharacterStream(int i, Reader reader, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNCharacterStream(String str, Reader reader, long j) throws SQLException {
        updateNCharacterStream(findColumn(str), reader, j);
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(int i, InputStream inputStream, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(String str, InputStream inputStream, long j) throws SQLException {
        updateAsciiStream(findColumn(str), inputStream, j);
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(int i, InputStream inputStream, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(String str, InputStream inputStream, long j) throws SQLException {
        updateBinaryStream(findColumn(str), inputStream, j);
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(int i, Reader reader, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(String str, Reader reader, long j) throws SQLException {
        updateCharacterStream(findColumn(str), reader, j);
    }

    @Override // java.sql.ResultSet
    public void updateBlob(int i, InputStream inputStream, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBlob(String str, InputStream inputStream, long j) throws SQLException {
        updateBlob(findColumn(str), inputStream, j);
    }

    @Override // java.sql.ResultSet
    public void updateClob(int i, Reader reader, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateClob(String str, Reader reader, long j) throws SQLException {
        updateClob(findColumn(str), reader, j);
    }

    @Override // java.sql.ResultSet
    public void updateNClob(int i, Reader reader, long j) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNClob(String str, Reader reader, long j) throws SQLException {
        updateNClob(findColumn(str), reader, j);
    }

    @Override // java.sql.ResultSet
    public void updateNCharacterStream(int i, Reader reader) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNCharacterStream(String str, Reader reader) throws SQLException {
        updateNCharacterStream(findColumn(str), reader);
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(int i, InputStream inputStream) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateAsciiStream(String str, InputStream inputStream) throws SQLException {
        updateAsciiStream(findColumn(str), inputStream);
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(int i, InputStream inputStream) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBinaryStream(String str, InputStream inputStream) throws SQLException {
        updateBinaryStream(findColumn(str), inputStream);
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(int i, Reader reader) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateCharacterStream(String str, Reader reader) throws SQLException {
        updateCharacterStream(findColumn(str), reader);
    }

    @Override // java.sql.ResultSet
    public void updateBlob(int i, InputStream inputStream) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateBlob(String str, InputStream inputStream) throws SQLException {
        updateBlob(findColumn(str), inputStream);
    }

    @Override // java.sql.ResultSet
    public void updateClob(int i, Reader reader) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateClob(String str, Reader reader) throws SQLException {
        updateClob(findColumn(str), reader);
    }

    @Override // java.sql.ResultSet
    public void updateNClob(int i, Reader reader) throws SQLException {
        throw new SQLFeatureNotSupportedException();
    }

    @Override // java.sql.ResultSet
    public void updateNClob(String str, Reader reader) throws SQLException {
        updateNClob(findColumn(str), reader);
    }

    @Override // java.sql.Wrapper
    public <T> T unwrap(Class<T> cls) throws SQLException {
        throw new SQLException("unsupported");
    }
}
